Part 1 Documentation [DOC]
	1. Addresses and Info
Part 2 Setup [SET]
	1. Equipment Screen
Part 3 ASM [ASM]
	ovl_kaleido_scope (33)
		1. Custom Equipment Screen
	code (28)
		1. REPLACE EQUIPMENT SYSTEM (Ammo Display)
		2. REPLACE EQUIPMENT SYSTEM (Set Ammo Function)
		3. REPLACE EQUIPMENT SYSTEM (Wallet Display)
		4. REPLACE EQUIPMENT SYSTEM (Sword, Boots, Tunic)
		5. REPLACE EQUIPMENT SYSTEM (Strength Display list)
		6. REPLACE EQUIPMENT SYSTEM (Upgrade Function)
		7. REPLACE EQUIPMENT SYSTEM (Scale)
		8. Four Rupee Counter Digits
		9. One-handed Hylian Shield
Part 4 Tables [TBL]
	ovl_kaleido_scope (33)
		1. Equipment Screen Column Positions
		2. Equipment Screen Display Data
		3. Remove Slot Usability Table
		4. Set up Equipment Usability Table
	code (28)
		1. Wallet Sizes
	ovl_player_actor (34)
		1. Set dive length to 5
	
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
Documentation [DOC]
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------

802229C4 Current Item Name
8012725C Item Icon Texture Table
803E94D8 Menu BG Texture Table 
803E3BC0 Equipment Icon Height
803E3B68 Equipment Icon Width
802229E0 Current Cursor Color Type

803E978C slot usability table
803E97B4 item usability table

803D79B4 check if you've selected slot 3
803D79DC check if your giant's knife is broken (name)
803D79E8 Set name to broken knife

803E3D84 Row Spacing
803E3B0A Equipment Object Y Offset	
803E3B24 Equipment Object X Offset	

80127204 bomb bag capacity table
801271F4 Item upgrade Mask table
80127464 Item Ammo Slot Table

802246FC Current tunic, sword, shield & boots

5000 = 0x1388
4321 = 0x10E1
-1000 = 0xFC18

----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
Setup [SET]
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
Sword		Shield		Tunic
Wallet		Bullet Bag	Bomb Bag
Quiver		Strength	Scale		

3 Upgrades per Item Table:
0	Quiver:		0x00000001,0x00000002,0x00000003
1	Bomb Bag:	0x00000004,0x00000008,0x0000000C
2	Strength:	0x00000010,0x00000020,0x00000030
3	Dive Meter: 0x00000040,0x00000080,0x000000C0
4	Wallet:		0x00000100,0x00000200,0x00000300
5	Bullet Bag:	0x00000400,0x00000800,0x00000C00
6	Deku Stick:	0x00001000,0x00002000,0x00003000
7	Deku Nut:	0x00004000,0x00008000,0x0000C000
8	Sword:		0x00010000,0x00020000,0x00030000
9	Shield:		0x00040000,0x00080000,0x000C0000
A	Tunic:		0x00100000,0x00200000,0x00300000
B	Boots:		0x00400000,0x00800000,0x00C00000
C	???:		0x01000000,0x02000000,0x03000000
D	???:		0x04000000,0x08000000,0x0C000000
E	???:		0x10000000,0x20000000,0x30000000
F	???:		0x40000000,0x80000000,0xC0000000
Default:		0x00500000

08090A04 05010002 03000000
3A3D4054 464C494F 52000000

----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
ASM [ASM]
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------

;_____________________________________________________________
;CUSTOM EQUIPMENT SCREEN
;This will replace the original equipment screen with the
;custom made one.
;_____________________________________________________________

.org 0x803D75DC
	BEQL	R0, R0, 0x803D7660	;Skip past Upgrade (Left)
.org 0x803D7618
	BEQL	R0, R0, 0x803D7660	;Skip past Upgrade (Both)
.org 0x803D7744
	BEQL	R0, R0, 0x803D778C	;Skip past Upgrade (Right)
.org 0x803D71BC
	BEQL	R0, R0, 0x803D73B0	;Skip past Upgrade (Right)
.org 0x803D7190
	BEQL	R0, R0, 0x803D73B0	;Skip past Upgrade (Right)
.org 0x803E406C
	ADDIU	V0, R0, 0x8000		;Hide Link Render
.org 0x803E3B08
	ADDIU	T5, R0, 0x002F		;Position First Row
.org 0x803E3D84
	ADDIU	T5, T5, 0xFFDC		;Row Spacing
.org 0x803D7644
	BNEL	R0, R0, 0x803D7660	;Move from Z to Grid
.org 0x803D7770
	BNEL	R0, R0, 0x803D778C	;Move from R to Grid
.org 0x803D71E8
	NOP							;Move Left on Grid
.org 0x803D7310
	NOP							;Move Right on Grid
.org 0x803D7470
	NOP							;Move Up on Grid
.org 0x803D751C
	NOP							;Move Down on Grid
.org 0x803D74A8
	SLTI	AT, A2, 0x0002		;Limit the cursor movement to row 0-2
.org 0x803E3DD8
	BEQL	R0, R0, 0x803E4044	;Hide Equip Borders
.org 0x803D7034
	BEQL	R0, R0, 0x803D70A4	;Hide Equip Borders
.org 0x803D7B44
	BEQL	R0, R0, 0x803D7CB0	;Disable Equipping
.org 0x803D7D9C
	ADDU	T2, R0, R0			;Stop Equipment from changing size when selected
.org 0x803E22E0
	BEQ		R0, R0, 0x803E2328	;Stop "A to Equip" from appearing when an item is selected
;;;;.org 0x803E2048
;;;;	ADDU	T8, R0, R0			;Set "to Equip" alpha to 0
.org 0x803E1F18	
	BEQ		R0, R0, 0x803E20AC	;Equipment Screen handles Empty Slots same way as Quest Status Screen
.org 0x803D7994
	ADDIU	T4, R0, 0x0000		;Equipment Object Cursor Type = 0 (Default/White)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Icon Display
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.org 0x803D81B0
	LW		V0, 0x00A0(T0)		;Set to 9C instead for Sword & Shield Word
	BEQ		R0, R0, 0x803D81FC	;Make it so that Broken Giant's Knife code is skipped
.org 0x803D81FC
	SLTI	T8, S3, 0x0009		;T8 = 1 if Current Upgrade Slot is less than 9
	BEQ		T8, R0, 0x803D8218	;Branch if Upgrade Slot is 9 or higher
	NOP
	J		0x803EDFD0
	NOP
.org 0x803D8224
	LW		A1, 0x0000(T7)
;Available Registers
;T0 = 0x8015E660
;T2, T4, T5, T7, T8, T9
;S3 = Current Upgrade Slot
;V0 = equipment
;If T8 is 0 after this, the slot will be empty
.org 0x803EDFD0
	LUI		T4, 0x803F				;T4 = 803F0000
	ADDU	T9, T4, S3				;T9 = 803F0000 + Upgrade Slot
	LBU		T4, 0xDFB0(T9)			;T4 = UpgradeID
	SLL		T5, T4, 0x0001			;T5 = UpgradeID<<1		(shiftedID)
	ADDIU	T7, R0, 0x0003			;T7 = 0x3
	SLLV	T7, T7, T5				;T7 = 0x3<<shiftedID 	(mask)
	AND		T8, V0, T7				;T8 = equipment&mask	(upgrade)
	SRAV	T7, T8, T5				;T7 = upgrade>>shiftedID(shiftedUpgrade)
	LBU		T9, 0xDFC0(T9)			;T9 = Upgrade Icon Start ID
	ADDU	T7, T7, T9				;T7 = Upgrade Icon Start ID + Upgrades
	SLL		T7, T7, 0x0002			;T7 = T7<<2 (to get table offset)
	J		0x803D8218
	ADDU	T7, S8, T7				;T7 = Upgrade Icon Offset
	

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Name Display
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	
;15E660
;803D79B0 to 803D79F4 (17 commands)
;Available: T3, T5, T6, T7, T9, S0, S7
;A1 is the Item ID by the end of the asm
;S7 is ??? by the end of the asm
;S2 = Current Row (1 frame delay)
;T8 = Current Row (0 frame delay)
;S3 = Current Equipment Slot (1 frame delay)
;T0 = SRAM (8015E660)
;A0 = 803EE248   (0xFD68(A0) == 803EDFB0)
	
.org 0x803D79A8
	BNE		T2, R0, noIcon		;Branch if the Z or R button is selected
	SUBU	T5, T8, S2			;T5 = REAL current row
	SLL		S0, T5, 0x0002		;S0 = Slot difference between REAL and normal
	ADDU	S0, S3, S0			;S0 = REAL equipment slot
	SUBU	S0, S0, T8			;S0 = Upgrade Slot (1 Indexed)
	LUI		T5, 0x803F			;T5 = 803F0000
	ADDU	T5, T5, S0			;T5 = 803F0000 + Upgrade Slot
	LBU		T3, 0xDFAF(T5)		;T3 = UpgradeID
	SLL		T3, T3, 0x0001		;T3 = UpgradeID<<1		(shiftedID)
	ADDIU	T6, R0, 0x0003		;T6 = 0x3
	SLLV	T6, T6, T3			;T6 = 0x3<<shiftedID 	(mask)
	LW		T7, 0x00A0(T0)		;T7 = equipment
	AND		T7, T7, T6			;T7 = equipment&mask	(upgrade)
	SRAV	T7, T7, T3			;T7 = upgrade>>shiftedID(shiftedUpgrade)
	LBU		A1, 0xDFBF(T5)		;A1 = Upgrade Icon Start ID
	ADDU	A1, A1, T7			;A1 = Upgrade Icon Start ID + shiftedUpgrade
	BEQL	T7, R0, end			;Perform command below if you don't have any upgrades in current slot
	noIcon:
	ADDIU	A1, R0, 0x03E7		;A1 = 0x03E7 (Hide Item Name)
	end:
	LHU		S7, 0x021E(S6)		;No idea. It is required.
	SH		A1, 0x0244(S6)		;No idea. It is required.
	
.org 0x803D7A00
	LHU		T3, 0x0244(S6)		;T3 = Item ID
	ADDIU	S8, R0, 0x03E7		;S8 = 0x03E7 (No Item)
	BEQL	T3, S8, fixClr		;Branch if no item is selected
	LHU		T3, 0x023C(S6)		;T3 = Item ID
	fixClr:
	LUI		S8, 0x803F			;S8 = 0x803F0000
	ADDIU	S8, S8, 0x97B4		;S8 = Item Usability Table Offset
	ADDU	T3, S8, T3			;T3 = Item Usability Offset
	LBU		V1, 0x0000(T3)		;V1 = Item Usability
	
;_____________________________________________________________
;REPLACE EQUIPMENT SYSTEM (Ammo Display)
;This part will change the ammo display to use the new system.
;_____________________________________________________________

;A2 = Pointer to Item Slot ID
.org 0x80089E8C	;Start code here instead?
	LBU		V1, 0x0000(A2)			;V1 = Item Slot ID
	LUI		T3, 0x8012				;T3 = 0x80120000
	ADDIU	T5, R0, 0x0006			;T5 = 0x0006 (Deku Stick Upgrade ID)
	BEQL	V1, R0, _pt1_checked	;Branch Likely if item is Deku Stick
		ADDIU T3, T3, 0x0030			;T3 = 0x80120000+Deku Stick Offset
	ADDIU	T5, R0, 0x0007			;T5 = 0x0007 (Deku Nut Upgrade ID)
	ADDIU	T4, R0, 0x0001			;T4 = 0x1 (Deku Nut)
	BEQL	V1, T4, _pt1_checked	;Branch Likely if item is Deku Nut
		ADDIU T3, T3, 0x0038			;T3 = 0x80120000+Deku Nut Offset
	ADDIU	T5, R0, 0x0001			;T5 = 0x0001 (Bomb BagUpgrade ID)
	ADDIU	T4, R0, 0x0002			;T4 = 0x2 (Bomb)
	BEQL	V1, T4, _pt1_checked	;Branch Likely if item is Bomb
		ADDIU T3, T3, 0x0008			;T3 = 0x80120000+Bomb Offset
	ADDIU	T5, R0, 0x0000			;T5 = 0x0000 (Quiver Upgrade ID)
	ADDIU	T4, R0, 0x0003			;T4 = 0x3 (Fairy Bow)
	BEQL	V1, T4, _pt1_checked	;Branch Likely if item is Fairy Bow
		ADDIU T3, T3, 0x0000			;T3 = 0x80120000+Fairy Bow Offset
	ADDIU	T5, R0, 0x0005			;T5 = 0x0005 (Bullet Bag Upgrade ID)
	ADDIU	T4, R0, 0x0006			;T4 = 0x6 (Fairy Slingshot)
	BEQL	V1, T4, _pt1_checked	;Branch Likely if item is Fairy Slingshot
		ADDIU T3, T3, 0x0028			;T3 = 0x80120000+Fairy Slingshot Offset
	ADDIU	T4, R0, 0x0008			;T4 = 0x8 (Bombchu)
	BEQL	V1, T4, _pt1_setCap		;Branch Likely if item is Bombchu
		ADDIU T3, R0, 0x0032			;T3 = 50
	ADDIU	T4, R0, 0x000E			;T4 = 0xE (Magic Beans)
	BEQL	V1, T4, _pt1_setCap		;Branch Likely if item is Magic Beans
		ADDIU T3, R0, 0x000F			;T3 = 15
	BEQ		R0, R0, 0x8008A048		;If none of above, skip past capacity check
	NOP
	;V1 = Item Slot ID
	;T3 = 0x80120000+Item Offset
	;T5 = Upgrade ID
	;Must add Capacity Entry Offset to T3
	_pt1_checked:
	SLL		T5, T5, 0x0001			;T5 = UpgradeID<<1		(shiftedID)
	ADDIU	V0, R0, 0x0003			;V0 = 0x3
	SLLV	V0, V0, T5				;V0 = 0x3<<shiftedID 	(mask)
	LW		T4, 0x00A0(A3)			;T4 = equipment			(equipment)
	AND		V0, T4, V0				;V0 = equipment&mask	(upgrade)
	SRAV	V0, V0, T5				;V0 = upgrade>>shiftedID(shiftedUpgrade)
	SLL		T5, V0, 0x0001			;T5 = shiftedUpgrade<<1	(capacityEntry)
	ADDU	T3, T3, T5				;T3 = 0x80120000+Item Offset+capacityEntry
	LHU		T3, 0x71FC(T3)			;T3 = Item Capacity
	_pt1_setCap:
	ADDU	T6, A3, V1				;T6 = 0x8015E660+Item Slot ID
	LB		V1, 0x008C(T6)			;V1 = Ammunition
	BEQ		T3, V1, 0x8008A020		;If you have maxed your ammo, branch
	NOP
	BEQ		R0, R0, 0x8008A048	;End
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	
;_____________________________________________________________
;REPLACE EQUIPMENT SYSTEM (Set Ammo Function)
;This will change the set ammo function to use the new system.
;_____________________________________________________________

;0x80087330 Set Ammo Function
;0x80087350 Get Ammo Slot
;0x80087678 Function Ends here

;START:
;T1 = 8015E660
;GOAL:
;T5 = Ammo Slot

;BEQ R0, R0, 0x80087658 when you have above capacity
;Also store Max ammo to 0x008C(V0)
;Branch to 0x8008765C when you have more than 0 ammo and load item slot ID to T5
;If you have less than 0 ammo, branch to 0x80087658 and set 0x008C(V0) to 0.

;T2 = Pointer to Item Slot ID
;A3 = Ammo to add/remove
;can use T1, T3, T4, T5, T6, T7, T8, T9
;A2 is changed to T2
;A3 is changed to T1
;V0 is changed to T7
;V1 is changed to T2
.org 0x80087384
	LH		A3, 0x0026(SP)			;ADDED ROW (A3 = Ammo to add/remove)
	LUI		T1, 0x8015				;ADDED ROW (T1 = 0x80150000)
	ORI		T1, T1, 0xE660			;ADDED ROW (T1 = 0x8015E660)
	LBU		T2, 0x0000(T2)			;T2 = Item Slot ID
	LUI		T3, 0x8012				;T3 = 0x80120000
	ADDIU	T5, R0, 0x0006			;T5 = 0x0006 (Deku Stick Upgrade ID)
	BEQL	T2, R0, _pt2_checked	;Branch Likely if item is Deku Stick
		ADDIU T3, T3, 0x0030			;T3 = 0x80120000+Deku Stick Offset
	ADDIU	T5, R0, 0x0007			;T5 = 0x0007 (Deku Nut Upgrade ID)
	ADDIU	T4, R0, 0x0001			;T4 = 0x1 (Deku Nut)
	BEQL	T2, T4, _pt2_checked	;Branch Likely if item is Deku Nut
		ADDIU T3, T3, 0x0038			;T3 = 0x80120000+Deku Nut Offset
	ADDIU	T5, R0, 0x0001			;T5 = 0x0001 (Bomb BagUpgrade ID)
	ADDIU	T4, R0, 0x0002			;T4 = 0x2 (Bomb)
	BEQL	T2, T4, _pt2_checked	;Branch Likely if item is Bomb
		ADDIU T3, T3, 0x0008			;T3 = 0x80120000+Bomb Offset
	ADDIU	T5, R0, 0x0000			;T5 = 0x0000 (Quiver Upgrade ID)
	ADDIU	T4, R0, 0x0003			;T4 = 0x3 (Fairy Bow)
	BEQL	T2, T4, _pt2_checked	;Branch Likely if item is Fairy Bow
		ADDIU T3, T3, 0x0000			;T3 = 0x80120000+Fairy Bow Offset
	ADDIU	T5, R0, 0x0005			;T5 = 0x0005 (Bullet Bag Upgrade ID)
	ADDIU	T4, R0, 0x0006			;T4 = 0x6 (Fairy Slingshot)
	BEQL	T2, T4, _pt2_checked	;Branch Likely if item is Fairy Slingshot
		ADDIU T3, T3, 0x0028			;T3 = 0x80120000+Fairy Slingshot Offset
	ADDIU	T4, R0, 0x0008			;T4 = 0x8 (Bombchu)
	BEQL	T2, T4, _pt2_calcCap	;Branch Likely if item is Bombchu
		ADDIU T3, R0, 0x0032			;T3 = 50
	ADDIU	T4, R0, 0x000E			;T4 = 0xE (Magic Beans)
	BEQL	T2, T4, _pt2_calcCap	;Branch Likely if item is Magic Beans
		ADDIU T3, R0, 0x000F			;T3 = 15
	BEQ		R0, R0, 0x8008A048		;If none of above, skip past capacity check
	NOP
	;T2 = Item Slot ID
	;T3 = 0x80120000+Item Offset
	;T5 = Upgrade ID
	;Must add Capacity Entry Offset to T3
	_pt2_checked:
	SLL		T5, T5, 0x0001			;T5 = UpgradeID<<1		(shiftedID)
	ADDIU	T7, R0, 0x0003			;T7 = 0x3
	SLLV	T7, T7, T5				;T7 = 0x3<<shiftedID 	(mask)
	LW		T4, 0x00A0(T1)			;T4 = equipment			(equipment)
	AND		T7, T4, T7				;T7 = equipment&mask	(upgrade)
	SRAV	T7, T7, T5				;T7 = upgrade>>shiftedID(shiftedUpgrade)
	SLL		T5, T7, 0x0001			;T5 = shiftedUpgrade<<1	(capacityEntry)
	ADDU	T3, T3, T5				;T3 = 0x80120000+Item Offset+capacityEntry
	LHU		T3, 0x71FC(T3)			;T3 = Item Capacity
	_pt2_calcCap:
	ADDU	T5, T2, R0				;ADDED ROW (T5 = Ammo Slot)
	ADDU	T6, T1, T2				;T6 = 0x8015E660+Item Slot ID
	LB		T2, 0x008C(T6)			;T2 = Ammo
	;All below this is added commands
	ADDU	T2, T2, A3				;T2 = New Ammo
	BLTZL	T2, _pt2_setCap			;Branch Likely if new ammo is less than 0
		ADDU	T2, R0, R0				;T2 = 0 (New Ammo)
	SLT		T4,	T2, T3				;Set T4 if your new ammo count is less than capacity
	BEQL	T4, R0, _pt2_setCap		;Brach Likely if new ammo isn't less than capacity
		ADDIU	T2, T3, 0x0000			;T2 = Item Capacity (New Ammo)
	_pt2_setCap:
	SB		T2, 0x008C(T6)			;Store new ammo
	BEQ		R0, R0, 0x8008765C		;New end branch
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP

;_____________________________________________________________
;REPLACE EQUIPMENT SYSTEM (Wallet Display)
;This will make the wallet use the new system.
;_____________________________________________________________

;Fix Max Wallet Size Check
.org 0x8008AE14 
	ANDI	T4, T2, 0x0300		;T6 = Upgrade Word AND Wallet Mask
.org 0x8008AE1C 
	SRL		T6, T4, 0x0008		;T6 = Masked Upgrade >> 0x8
;Fix Wallet Digit Length Check
.org 0x8008AF80
	ANDI	T6, T4, 0x0300		;T6 = Upgrade Word AND Wallet Mask
	SRL		V0, T6, 0x0008		;V0 = Masked Upgrade >> 0x8

;_____________________________________________________________
;REPLACE EQUIPMENT SYSTEM (Sword, Boots, Tunic)
;This will make the shield, boots and tunic update function
;uses the new system.
;_____________________________________________________________

;0x8008ECAC Update equipped Equipment

.org 0x8008ECDC
	LW		T7, 0x00A0(V0)		;T7 = Equipment
	LUI		T8, 0x000C			;T8 = 0x000C0000 (Shield Mask)
	ADDIU	A0, A0, 0x71F0		;Already there
	ADDIU	T0, R0, 0x0012		;T0 = 0x0012 (Shift steps)
	
.org 0x8008ECFC
	LW		T2, 0x00A0(V0)		;T2 = Equipment
	LUI		T3, 0x0030			;T3 = 0x00300000 (Tunic Mask)
	ADDIU	T5, R0, 0x0014		;T5 = 0x0016 (Shift steps)
	
.org 0x8008ED18
	LUI		T9, 0x00C0			;T9 = 0x00C00000 (Boots Mask)
	LW		T8, 0x00A0(V0)		;T8 = Equipment
	ADDIU	T1, R0, 0x0016		;T1 = 0x0016 (Shift Steps)
	
;_____________________________________________________________
;REPLACE EQUIPMENT SYSTEM (Strength Display list)
;This will make the strength upgrade use the new system.
;It will also make it so that it checks for boots as child.
;_____________________________________________________________

;Include Boots section for child
;.org 0x8008F684
;	BNEZL	T8, 0x8008F7D0		;Branch to Boots section if your child instead of strength upgrade
;	LW		A2, 0x00A0(SP)		;Set A2 to currently equipped boots
;.org 0x8008F7D8
;	BEQ		A2, R0, 0x8008F830	;Change branch to include child strength upgrade after boots
;.org 0x8008F818
;	BEQ		R0, R0, 0x8008F830	;Change branch to include child strength upgrade after boots


;00336A2C location of boots display list in ram
;802246FF location of currrent boots in ram
;8012601C display list pointers for iron boots and hover boots in ram
;child:
;0601AEC8 Left
;0601B010 Right
;adult:
;06025918 = Left
;06025A60 = Right


.org 0x8008F830
	
;Fix equipment system
.org 0x8008F054
	ANDI	T8, T6, 0x0030		;Upgrade Word AND Strength Mask
.org 0x8008F05C
	SRA		V1, T8, 0x0004		;Masked Upgrade >> 0x4
	
	
;_____________________________________________________________
;REPLACE EQUIPMENT SYSTEM (Upgrade Function)
;This will make the function that upgrades your equipment use
;the new system.
;_____________________________________________________________

;A0 = ID
.org 0x80097BAC
	SLL		T7, A0, 0x0001		;T7 = shiftedID
	ADDIU	T8, R0, 0x0003		;T8 = 0x0003
	LW		T6, 0xE700(V0)		;T6 = equipment
	SLLV	T8, T8, T7			;T8 = filter (0x0003<<shiftedID)
	NOR		T8, T8, R0			;T8 = reversed filter
	AND		T8, T6, T8			;T8 = reverse upgrade (equipment&filter)
	SLLV	T9, A1, T7			;T9 = new upgrade shifted (new upgrade << shiftedID)
	OR		T3, T8, T9			;T3 = new upgrade word (reverse upgrade & new upgrade shifted)
	SW		T3, 0xE700(V0)		;T6 = equipment
	SW		A1, 0x0004(SP)		;Was already there
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	JR		RA
	NOP

;_____________________________________________________________
;REPLACE EQUIPMENT SYSTEM (Scale)
;This will make it so that the silver scale extends the time
;you can breathe under water rather than increasing the
;distance that you can dive.
;_____________________________________________________________

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Breathe Length
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;S5 = 0x8015E660
.org 0x8008C608
	LW 		T7, 0x00A0 (S5)		;T7 = Equipment
	ANDI 	T2, T7, 0x00C0		;T2 = Upgrade
	BEQL	T2, R0, noScale		;Branch Likely if you don't have a scale
	ADDIU	T2, R0, 0x001E		;Set timer to 30 seconds
	ADDIU	T2, R0, 0x003C		;Set timer to 60 seconds
	noScale:
	ADDIU 	A0, R0, 0x0002
	SH 		A0, 0x13CE (S5)
	ADDIU 	V1, R0, 0x0014
	SH 		T2, 0x13D0 (S5)
	LUI 	AT, 0x8016
	SH 		V1, 0xFFE2 (AT)
	ADDIU 	A1, R0, 0x0014
	ADDIU 	S2, AT, 0xFFE8

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Gold Scale (Infinite breathing)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	
.org 0x8008DB10
	ADDIU	T7, R0, 0x00C0		;T7 = Upgrade Filter
	LW		T8, 0x00A0(T0)		;T8 = Equipment
	NOP
	ADDIU	T9, R0, 0x0006		;T9 = Shift Amount
.org 0x8008DB24
	ADDIU	AT, R0, 0x0002		;Must have Scale Upgrade 2 to breathe infinitely
	
	
;_____________________________________________________________
;4 DIGIT WALLET
;This will make it so that the rupee display can show up to
;4 digits.
;_____________________________________________________________

.org 0x8008AEEC
	SD R0, 0x0230(S6)				;Clear the digits
	ADDIU T3, R0, 0x0000			;Clear T3
	NOP
.org 0x8008AF04
	SLTI	AT, V0, 0x03E8			;Set if you have less than 1000 rupees
	BNE		AT, R0, 0x8008AF20		;Branch if you have less than 1000 rupees
	ADDIU	T3, T3, 0x0001			;Add 0x1 to digit
	ADDIU	V0, V0, 0xFC18			;T8 = Rupees - 1000
	SH		V0, 0x0236(S6)			;Store new rupee count
	BEQ		R0, R0, 0x8008AF04		;Branch back to start
	SH		T3, 0x0230(S6)			;Store 1000th digit
.org 0x8008AFAC
	LH		T2, 0x0230(T9)

;_____________________________________________________________
;ONE-HANDED HYLIAN SHIELD
;This will make the strength upgrade use the new system.
;_____________________________________________________________

.org 0x8008E9E8
	NOP								;Make Child Link wear Hylian Shield like adult link


----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
Tables [TBL]
----------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------

;_____________________________________________________________
;ovl_kaleido_scope
;_____________________________________________________________


;Position Equipment Screen Columns
0x803E9CBC,8000 FFC0 FFF0 0020

;Equipment Screen Display Data
0x803EDFB0,08090A04 05010002 03000000 00000000
0x803EDFC0,3A3D4054 464C494F 52000000 00000000

;Remove Slot Usability Table
0x803E9794,00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 

;Set up Equipment Usability	Table (Makes everything except SOLD OUT equippable by Child Link)				  CT								  AT										EQ									EQ
0x803E97B4,01 09 09 09 09 09 01 09 09 09 09 09 09 09 01 09 01 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 09 01 01 01 01 01 01 01 01 01 01 01 02 09 09 09 09 09 09 09 09 09 09 09 09 09 09 01 09 09 01 09 09 09 09 09 09 09 09 01 01 01 09 09 09 09 09 09 01 09 09 09 09 09 09 09

;_____________________________________________________________
;code
;_____________________________________________________________

;Set wallet digit shifts to 1, 1, 0, 0
0x80125B3C,0001 0001 0000 0000
;Set wallet lengths to 3, 3, 4 & 4
0x80125B44,0003 0003 0004 0004
;Set wallet capacity to 200, 500, 1000 & 2000
0x8012721C,00C8 01F4 03E8 07D0

;_____________________________________________________________
;ovl_player_actor
;_____________________________________________________________

;Set dive length to 5
0x803F4924,43480000 43480000 43480000